<template>
  <div>
    <el-dialog :title="info.title" :visible.sync="info.isShow">
      <el-form :model="form">
        <el-form-item label="会员编号" :label-width="formLabelWidth">
          <el-input v-model="form.uid"></el-input>
        </el-form-item>

        <el-form-item label="昵称" :label-width="formLabelWidth">
          <el-input v-model="form.nickname"></el-input>
        </el-form-item>

        <el-form-item label="手机号" :label-width="formLabelWidth">
          <el-input v-model="form.phone"></el-input>
        </el-form-item>

        <el-form-item label="密码" :label-width="formLabelWidth">
          <el-input v-model="form.password"></el-input>
        </el-form-item>

        <el-form-item label="状态" :label-width="formLabelWidth">
          <el-switch
            v-model="form.status"
            active-color="blue"
            inactive-color="grey"
            :active-value="1"
            :inactive-value="2"
          >
          </el-switch>
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" v-if="info.isAdd">确 定</el-button>
        <el-button type="primary" @click="update" v-else>修 改</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {mapGetters,mapActions} from "vuex"
import {vipOne} from "../../../request/api"
export default {
  data() {
    return {
      form: {
        uid: "",
        nickname: "",
        phone: "",
        password: "",
        status: 1,
      },
      formLabelWidth:"70px"
    };
  },
  props: ["info"],
  computed: {
    ...mapGetters({
      tableData: "vip/vip",
    }),
  },
  methods: {
    ...mapActions({
      vipListActions: "vip/vipListActions",
      vipUpdateActions:"vip/vipUpdateActions"
    }),
    cancel() {
      this.form = {
        uid: "",
        nickname: "",
        phone: "",
        password: "",
        status: 1,
      };
      this.info.isShow=false;
    },
    goDetail(uid){
        vipOne({uid}).then(res=>{
          if(res.code===200){
            this.form=res.list;
          }
        })
    },
    update(){
        this.vipUpdateActions(this.form);
        this.vipListActions();
        this.cancel();
    }
  },
};
</script>

<style>
</style>